/*
 * @(#)WeightedSynset.java	1.0 09/01/07
 *
 * Copyright 2007 Fabio Gasparetti. All rights reserved.
 */

package org.tabularium.text.nlp;

import org.tabularium.text.nlp.wordnet.Synset;

/**
 * Wraps up a wordnet synset assigning a weight to it.
 * 
 * @author Fabio Gasparetti
 * @version 1.0, 09/01/07
 */
public class WeightedSynset implements Comparable {

	protected Synset synset;
	protected double weight;
	
	public WeightedSynset(Synset s) {
		synset = s;
		weight = 0d;
	}
	
	public WeightedSynset(Synset s, double w) {
		synset = s;
		weight = w;
	}
	
	public Synset getSynset() {
		return synset;
	}

	public double getWeight() {
		return weight;
	}
	
	public void setWeight(double weight) {
		this.weight = weight;
	}

	public int compareTo(Object arg0) {
		if (this == arg0)
			return 0;
		WeightedSynset ws = (WeightedSynset)arg0;
		double c = weight - ws.weight;
		if (c < 0) 
			return -1;
		else if (c > 0)
			return 1;
		return synset.getId().compareTo(ws.getSynset().getId());
	}

}